package bairui.international.service.impl;

import bairui.international.model.domain.jpa.TB_BranchCompanyStaff;
import bairui.international.service.Service_BranchCompanyStaff_Generate;
import org.springframework.stereotype.Service;
import bairui.international.dao.jpa.Repository_BranchCompanyStaff;

/**
 *
 */
@Service
public class Service_BranchCompanyStaffImpl_Generate
	implements Service_BranchCompanyStaff_Generate
{

	
	@org.springframework.beans.factory.annotation.Autowired
	private Repository_BranchCompanyStaff dao;

	@org.springframework.beans.factory.annotation.Autowired
	private bairui.international.service.Service_BranchCompanyStaff service_BranchCompanyStaff;

	@org.springframework.beans.factory.annotation.Autowired
	private bairui.international.service.Service_ProductOrder service_ProductOrder;

	@org.springframework.beans.factory.annotation.Autowired
	private bairui.international.service.Service_BranchCompanyStaffRoyaltyRecord service_BranchCompanyStaffRoyaltyRecord;

	@org.springframework.beans.factory.annotation.Autowired
	private bairui.international.service.Service_BranchCompanyStaffMoneyRecord service_BranchCompanyStaffMoneyRecord;

	@org.springframework.beans.factory.annotation.Autowired
	private bairui.international.service.Service_BranchCompanyStaffWithdrawOrder service_BranchCompanyStaffWithdrawOrder;

	@org.springframework.beans.factory.annotation.Autowired
	private bairui.international.service.Service_BranchCompanyMoneyRecord service_BranchCompanyMoneyRecord;

	@org.springframework.beans.factory.annotation.Autowired
	private bairui.international.service.Service_BranchCompanyWithdrawOrder service_BranchCompanyWithdrawOrder;

	@org.springframework.beans.factory.annotation.Autowired
	private bairui.international.service.Service_User service_User;



	
	
	
	/**
	 * deleteById
	 */
	public void deleteById(
		@com.sh_lianjing.annotation.ParameterName("id") @lombok.NonNull Long id
	) throws Exception {
		TB_BranchCompanyStaff bean = getDao().findById(id).get();
		// nexts
		java.util.List<bairui.international.model.domain.jpa.TB_BranchCompanyStaff> nexts = service_BranchCompanyStaff.page(it->it.prev.eq(bean), org.springframework.data.domain.PageRequest.of(0, 3)).getContent();
		
		if(!nexts.isEmpty()){
			String str = "("+bean.toString()+")正在被("+bairui.international.model.domain.jpa.TTB_BranchCompanyStaff.Comment+":[";
			boolean startFlag = true;
			for(bairui.international.model.domain.jpa.TB_BranchCompanyStaff item : nexts){
				if(!startFlag){
					str += ", ";
				}
				startFlag = false;
				str += item.toString();
			}
			str += ", ...])使用";
			throw new com.lianjing.sh.validate.spring.exception.ValidateObjectException("", "nexts", str);
		}
		// assignOrders
		java.util.List<bairui.international.model.domain.jpa.TB_ProductOrder> assignOrders = service_ProductOrder.page(it->it.assignor.eq(bean), org.springframework.data.domain.PageRequest.of(0, 3)).getContent();
		
		if(!assignOrders.isEmpty()){
			String str = "("+bean.toString()+")正在被("+bairui.international.model.domain.jpa.TTB_ProductOrder.Comment+":[";
			boolean startFlag = true;
			for(bairui.international.model.domain.jpa.TB_ProductOrder item : assignOrders){
				if(!startFlag){
					str += ", ";
				}
				startFlag = false;
				str += item.toString();
			}
			str += ", ...])使用";
			throw new com.lianjing.sh.validate.spring.exception.ValidateObjectException("", "assignOrders", str);
		}
		// sendOrders
		java.util.List<bairui.international.model.domain.jpa.TB_ProductOrder> sendOrders = service_ProductOrder.page(it->it.sender.eq(bean), org.springframework.data.domain.PageRequest.of(0, 3)).getContent();
		
		if(!sendOrders.isEmpty()){
			String str = "("+bean.toString()+")正在被("+bairui.international.model.domain.jpa.TTB_ProductOrder.Comment+":[";
			boolean startFlag = true;
			for(bairui.international.model.domain.jpa.TB_ProductOrder item : sendOrders){
				if(!startFlag){
					str += ", ";
				}
				startFlag = false;
				str += item.toString();
			}
			str += ", ...])使用";
			throw new com.lianjing.sh.validate.spring.exception.ValidateObjectException("", "sendOrders", str);
		}
		// branchCompanyStaffRoyaltyRecords
		java.util.List<bairui.international.model.domain.jpa.TB_BranchCompanyStaffRoyaltyRecord> branchCompanyStaffRoyaltyRecords = service_BranchCompanyStaffRoyaltyRecord.page(it->it.branchCompanyStaff.eq(bean), org.springframework.data.domain.PageRequest.of(0, 3)).getContent();
		
		if(!branchCompanyStaffRoyaltyRecords.isEmpty()){
			String str = "("+bean.toString()+")正在被("+bairui.international.model.domain.jpa.TTB_BranchCompanyStaffRoyaltyRecord.Comment+":[";
			boolean startFlag = true;
			for(bairui.international.model.domain.jpa.TB_BranchCompanyStaffRoyaltyRecord item : branchCompanyStaffRoyaltyRecords){
				if(!startFlag){
					str += ", ";
				}
				startFlag = false;
				str += item.toString();
			}
			str += ", ...])使用";
			throw new com.lianjing.sh.validate.spring.exception.ValidateObjectException("", "branchCompanyStaffRoyaltyRecords", str);
		}
		// branchCompanyStaffMoneyRecords
		java.util.List<bairui.international.model.domain.jpa.TB_BranchCompanyStaffMoneyRecord> branchCompanyStaffMoneyRecords = service_BranchCompanyStaffMoneyRecord.page(it->it.branchCompanyStaff.eq(bean), org.springframework.data.domain.PageRequest.of(0, 3)).getContent();
		
		if(!branchCompanyStaffMoneyRecords.isEmpty()){
			String str = "("+bean.toString()+")正在被("+bairui.international.model.domain.jpa.TTB_BranchCompanyStaffMoneyRecord.Comment+":[";
			boolean startFlag = true;
			for(bairui.international.model.domain.jpa.TB_BranchCompanyStaffMoneyRecord item : branchCompanyStaffMoneyRecords){
				if(!startFlag){
					str += ", ";
				}
				startFlag = false;
				str += item.toString();
			}
			str += ", ...])使用";
			throw new com.lianjing.sh.validate.spring.exception.ValidateObjectException("", "branchCompanyStaffMoneyRecords", str);
		}
		// branchCompanyStaffWithdrawOrders
		java.util.List<bairui.international.model.domain.jpa.TB_BranchCompanyStaffWithdrawOrder> branchCompanyStaffWithdrawOrders = service_BranchCompanyStaffWithdrawOrder.page(it->it.branchCompanyStaff.eq(bean), org.springframework.data.domain.PageRequest.of(0, 3)).getContent();
		
		if(!branchCompanyStaffWithdrawOrders.isEmpty()){
			String str = "("+bean.toString()+")正在被("+bairui.international.model.domain.jpa.TTB_BranchCompanyStaffWithdrawOrder.Comment+":[";
			boolean startFlag = true;
			for(bairui.international.model.domain.jpa.TB_BranchCompanyStaffWithdrawOrder item : branchCompanyStaffWithdrawOrders){
				if(!startFlag){
					str += ", ";
				}
				startFlag = false;
				str += item.toString();
			}
			str += ", ...])使用";
			throw new com.lianjing.sh.validate.spring.exception.ValidateObjectException("", "branchCompanyStaffWithdrawOrders", str);
		}
		// branchCompanyMoneyRecords
		java.util.List<bairui.international.model.domain.jpa.TB_BranchCompanyMoneyRecord> branchCompanyMoneyRecords = service_BranchCompanyMoneyRecord.page(it->it.branchCompanyStaff.eq(bean), org.springframework.data.domain.PageRequest.of(0, 3)).getContent();
		
		if(!branchCompanyMoneyRecords.isEmpty()){
			String str = "("+bean.toString()+")正在被("+bairui.international.model.domain.jpa.TTB_BranchCompanyMoneyRecord.Comment+":[";
			boolean startFlag = true;
			for(bairui.international.model.domain.jpa.TB_BranchCompanyMoneyRecord item : branchCompanyMoneyRecords){
				if(!startFlag){
					str += ", ";
				}
				startFlag = false;
				str += item.toString();
			}
			str += ", ...])使用";
			throw new com.lianjing.sh.validate.spring.exception.ValidateObjectException("", "branchCompanyMoneyRecords", str);
		}
		// branchCompanyWithdrawOrders
		java.util.List<bairui.international.model.domain.jpa.TB_BranchCompanyWithdrawOrder> branchCompanyWithdrawOrders = service_BranchCompanyWithdrawOrder.page(it->it.branchCompanyStaff.eq(bean), org.springframework.data.domain.PageRequest.of(0, 3)).getContent();
		
		if(!branchCompanyWithdrawOrders.isEmpty()){
			String str = "("+bean.toString()+")正在被("+bairui.international.model.domain.jpa.TTB_BranchCompanyWithdrawOrder.Comment+":[";
			boolean startFlag = true;
			for(bairui.international.model.domain.jpa.TB_BranchCompanyWithdrawOrder item : branchCompanyWithdrawOrders){
				if(!startFlag){
					str += ", ";
				}
				startFlag = false;
				str += item.toString();
			}
			str += ", ...])使用";
			throw new com.lianjing.sh.validate.spring.exception.ValidateObjectException("", "branchCompanyWithdrawOrders", str);
		}
		// verifiedWithdrawOrders
		java.util.List<bairui.international.model.domain.jpa.TB_BranchCompanyStaffWithdrawOrder> verifiedWithdrawOrders = service_BranchCompanyStaffWithdrawOrder.page(it->it.verifior.eq(bean), org.springframework.data.domain.PageRequest.of(0, 3)).getContent();
		
		if(!verifiedWithdrawOrders.isEmpty()){
			String str = "("+bean.toString()+")正在被("+bairui.international.model.domain.jpa.TTB_BranchCompanyStaffWithdrawOrder.Comment+":[";
			boolean startFlag = true;
			for(bairui.international.model.domain.jpa.TB_BranchCompanyStaffWithdrawOrder item : verifiedWithdrawOrders){
				if(!startFlag){
					str += ", ";
				}
				startFlag = false;
				str += item.toString();
			}
			str += ", ...])使用";
			throw new com.lianjing.sh.validate.spring.exception.ValidateObjectException("", "verifiedWithdrawOrders", str);
		}
		// customers
		java.util.List<bairui.international.model.domain.jpa.TB_User> customers = service_User.page(it->it.sender.eq(bean), org.springframework.data.domain.PageRequest.of(0, 3)).getContent();
		
		if(!customers.isEmpty()){
			String str = "("+bean.toString()+")正在被("+bairui.international.model.domain.jpa.TTB_User.Comment+":[";
			boolean startFlag = true;
			for(bairui.international.model.domain.jpa.TB_User item : customers){
				if(!startFlag){
					str += ", ";
				}
				startFlag = false;
				str += item.toString();
			}
			str += ", ...])使用";
			throw new com.lianjing.sh.validate.spring.exception.ValidateObjectException("", "customers", str);
		}
		getDao().deleteById(id);
	}
	/**
	 * findDeleteById
	 */
	public TB_BranchCompanyStaff findDeleteById(
		@com.sh_lianjing.annotation.ParameterName("id") @lombok.NonNull Long id
	) throws Exception {
		TB_BranchCompanyStaff bean = getDao().findById(id).get();
		// nexts
		java.util.List<bairui.international.model.domain.jpa.TB_BranchCompanyStaff> nexts = service_BranchCompanyStaff.page(it->it.prev.eq(bean), org.springframework.data.domain.PageRequest.of(0, 3)).getContent();
		
		if(!nexts.isEmpty()){
			String str = "("+bean.toString()+")正在被("+bairui.international.model.domain.jpa.TTB_BranchCompanyStaff.Comment+":[";
			boolean startFlag = true;
			for(bairui.international.model.domain.jpa.TB_BranchCompanyStaff item : nexts){
				if(!startFlag){
					str += ", ";
				}
				startFlag = false;
				str += item.toString();
			}
			str += ", ...])使用";
			throw new com.lianjing.sh.validate.spring.exception.ValidateObjectException("", "nexts", str);
		}
		// assignOrders
		java.util.List<bairui.international.model.domain.jpa.TB_ProductOrder> assignOrders = service_ProductOrder.page(it->it.assignor.eq(bean), org.springframework.data.domain.PageRequest.of(0, 3)).getContent();
		
		if(!assignOrders.isEmpty()){
			String str = "("+bean.toString()+")正在被("+bairui.international.model.domain.jpa.TTB_ProductOrder.Comment+":[";
			boolean startFlag = true;
			for(bairui.international.model.domain.jpa.TB_ProductOrder item : assignOrders){
				if(!startFlag){
					str += ", ";
				}
				startFlag = false;
				str += item.toString();
			}
			str += ", ...])使用";
			throw new com.lianjing.sh.validate.spring.exception.ValidateObjectException("", "assignOrders", str);
		}
		// sendOrders
		java.util.List<bairui.international.model.domain.jpa.TB_ProductOrder> sendOrders = service_ProductOrder.page(it->it.sender.eq(bean), org.springframework.data.domain.PageRequest.of(0, 3)).getContent();
		
		if(!sendOrders.isEmpty()){
			String str = "("+bean.toString()+")正在被("+bairui.international.model.domain.jpa.TTB_ProductOrder.Comment+":[";
			boolean startFlag = true;
			for(bairui.international.model.domain.jpa.TB_ProductOrder item : sendOrders){
				if(!startFlag){
					str += ", ";
				}
				startFlag = false;
				str += item.toString();
			}
			str += ", ...])使用";
			throw new com.lianjing.sh.validate.spring.exception.ValidateObjectException("", "sendOrders", str);
		}
		// branchCompanyStaffRoyaltyRecords
		java.util.List<bairui.international.model.domain.jpa.TB_BranchCompanyStaffRoyaltyRecord> branchCompanyStaffRoyaltyRecords = service_BranchCompanyStaffRoyaltyRecord.page(it->it.branchCompanyStaff.eq(bean), org.springframework.data.domain.PageRequest.of(0, 3)).getContent();
		
		if(!branchCompanyStaffRoyaltyRecords.isEmpty()){
			String str = "("+bean.toString()+")正在被("+bairui.international.model.domain.jpa.TTB_BranchCompanyStaffRoyaltyRecord.Comment+":[";
			boolean startFlag = true;
			for(bairui.international.model.domain.jpa.TB_BranchCompanyStaffRoyaltyRecord item : branchCompanyStaffRoyaltyRecords){
				if(!startFlag){
					str += ", ";
				}
				startFlag = false;
				str += item.toString();
			}
			str += ", ...])使用";
			throw new com.lianjing.sh.validate.spring.exception.ValidateObjectException("", "branchCompanyStaffRoyaltyRecords", str);
		}
		// branchCompanyStaffMoneyRecords
		java.util.List<bairui.international.model.domain.jpa.TB_BranchCompanyStaffMoneyRecord> branchCompanyStaffMoneyRecords = service_BranchCompanyStaffMoneyRecord.page(it->it.branchCompanyStaff.eq(bean), org.springframework.data.domain.PageRequest.of(0, 3)).getContent();
		
		if(!branchCompanyStaffMoneyRecords.isEmpty()){
			String str = "("+bean.toString()+")正在被("+bairui.international.model.domain.jpa.TTB_BranchCompanyStaffMoneyRecord.Comment+":[";
			boolean startFlag = true;
			for(bairui.international.model.domain.jpa.TB_BranchCompanyStaffMoneyRecord item : branchCompanyStaffMoneyRecords){
				if(!startFlag){
					str += ", ";
				}
				startFlag = false;
				str += item.toString();
			}
			str += ", ...])使用";
			throw new com.lianjing.sh.validate.spring.exception.ValidateObjectException("", "branchCompanyStaffMoneyRecords", str);
		}
		// branchCompanyStaffWithdrawOrders
		java.util.List<bairui.international.model.domain.jpa.TB_BranchCompanyStaffWithdrawOrder> branchCompanyStaffWithdrawOrders = service_BranchCompanyStaffWithdrawOrder.page(it->it.branchCompanyStaff.eq(bean), org.springframework.data.domain.PageRequest.of(0, 3)).getContent();
		
		if(!branchCompanyStaffWithdrawOrders.isEmpty()){
			String str = "("+bean.toString()+")正在被("+bairui.international.model.domain.jpa.TTB_BranchCompanyStaffWithdrawOrder.Comment+":[";
			boolean startFlag = true;
			for(bairui.international.model.domain.jpa.TB_BranchCompanyStaffWithdrawOrder item : branchCompanyStaffWithdrawOrders){
				if(!startFlag){
					str += ", ";
				}
				startFlag = false;
				str += item.toString();
			}
			str += ", ...])使用";
			throw new com.lianjing.sh.validate.spring.exception.ValidateObjectException("", "branchCompanyStaffWithdrawOrders", str);
		}
		// branchCompanyMoneyRecords
		java.util.List<bairui.international.model.domain.jpa.TB_BranchCompanyMoneyRecord> branchCompanyMoneyRecords = service_BranchCompanyMoneyRecord.page(it->it.branchCompanyStaff.eq(bean), org.springframework.data.domain.PageRequest.of(0, 3)).getContent();
		
		if(!branchCompanyMoneyRecords.isEmpty()){
			String str = "("+bean.toString()+")正在被("+bairui.international.model.domain.jpa.TTB_BranchCompanyMoneyRecord.Comment+":[";
			boolean startFlag = true;
			for(bairui.international.model.domain.jpa.TB_BranchCompanyMoneyRecord item : branchCompanyMoneyRecords){
				if(!startFlag){
					str += ", ";
				}
				startFlag = false;
				str += item.toString();
			}
			str += ", ...])使用";
			throw new com.lianjing.sh.validate.spring.exception.ValidateObjectException("", "branchCompanyMoneyRecords", str);
		}
		// branchCompanyWithdrawOrders
		java.util.List<bairui.international.model.domain.jpa.TB_BranchCompanyWithdrawOrder> branchCompanyWithdrawOrders = service_BranchCompanyWithdrawOrder.page(it->it.branchCompanyStaff.eq(bean), org.springframework.data.domain.PageRequest.of(0, 3)).getContent();
		
		if(!branchCompanyWithdrawOrders.isEmpty()){
			String str = "("+bean.toString()+")正在被("+bairui.international.model.domain.jpa.TTB_BranchCompanyWithdrawOrder.Comment+":[";
			boolean startFlag = true;
			for(bairui.international.model.domain.jpa.TB_BranchCompanyWithdrawOrder item : branchCompanyWithdrawOrders){
				if(!startFlag){
					str += ", ";
				}
				startFlag = false;
				str += item.toString();
			}
			str += ", ...])使用";
			throw new com.lianjing.sh.validate.spring.exception.ValidateObjectException("", "branchCompanyWithdrawOrders", str);
		}
		// verifiedWithdrawOrders
		java.util.List<bairui.international.model.domain.jpa.TB_BranchCompanyStaffWithdrawOrder> verifiedWithdrawOrders = service_BranchCompanyStaffWithdrawOrder.page(it->it.verifior.eq(bean), org.springframework.data.domain.PageRequest.of(0, 3)).getContent();
		
		if(!verifiedWithdrawOrders.isEmpty()){
			String str = "("+bean.toString()+")正在被("+bairui.international.model.domain.jpa.TTB_BranchCompanyStaffWithdrawOrder.Comment+":[";
			boolean startFlag = true;
			for(bairui.international.model.domain.jpa.TB_BranchCompanyStaffWithdrawOrder item : verifiedWithdrawOrders){
				if(!startFlag){
					str += ", ";
				}
				startFlag = false;
				str += item.toString();
			}
			str += ", ...])使用";
			throw new com.lianjing.sh.validate.spring.exception.ValidateObjectException("", "verifiedWithdrawOrders", str);
		}
		// customers
		java.util.List<bairui.international.model.domain.jpa.TB_User> customers = service_User.page(it->it.sender.eq(bean), org.springframework.data.domain.PageRequest.of(0, 3)).getContent();
		
		if(!customers.isEmpty()){
			String str = "("+bean.toString()+")正在被("+bairui.international.model.domain.jpa.TTB_User.Comment+":[";
			boolean startFlag = true;
			for(bairui.international.model.domain.jpa.TB_User item : customers){
				if(!startFlag){
					str += ", ";
				}
				startFlag = false;
				str += item.toString();
			}
			str += ", ...])使用";
			throw new com.lianjing.sh.validate.spring.exception.ValidateObjectException("", "customers", str);
		}
		getDao().deleteById(id);
		return bean;
	}
	/**
	 * deleteByIds
	 */
	public void deleteByIds(
		@com.sh_lianjing.annotation.ParameterName("ids") @lombok.NonNull Long ... ids
	) throws Exception {
		deleteByIds(java.util.Arrays.asList(ids));
	}
	
	/**
	 * deleteByIds
	 */
	public void deleteByIds(
		@com.sh_lianjing.annotation.ParameterName("ids") @lombok.NonNull java.util.List<Long> ids
	) throws Exception {
		for(Long id : ids){
			deleteById(id);
		}
	}
		






	/**
	 * getDao()
	 */
	public bairui.international.dao.jpa.Repository_BranchCompanyStaff getDao() {
		return dao;
	}

}
